#ifndef WebSocketService_WSProtocol_AbstractDb_H
#define WebSocketService_WSProtocol_AbstractDb_H

#include <vector>
#include <rutil/Data.hxx>

static const char *tableNames[1] = {"plateinfo"};

class AbstractDb {
public :

    AbstractDb();

    virtual ~AbstractDb();

    class PlateInfoRecord;

    enum Table {
        PlateInfoTable = 0,
        MaxTable // This one MUST be last
    };

    typedef resip::Data Key;

    class PlateInfoRecord {
        ////    Constructors and destructors    ////

    public :

        PlateInfoRecord();

        ~PlateInfoRecord();

        ////    Attributes    ////

        std::string _iD;        //## attribute _Id

        std::string _plateName;        //## attribute _plateName

        std::string _plateType;        //## attribute _plateType

        float _confidence;        //## attribute _confidence

        std::string _fullPath;        //## attribute _fullPath

        std::string _platePath;        //## attribute _platePath

        std::string _createTime;        //## attribute _createTime
    };

    //## operation isSane()
    virtual bool isSane() = 0;

    virtual resip::Data dbNextKey(const Table table, bool first = false) = 0;

    virtual resip::Data dbFirstKey(const Table table);

    AbstractDb::Key firstDeviceInfoKey();

    AbstractDb::Key nextDeviceInfoKey();

    //## operation dbEraseRecord()
    virtual bool dbEraseRecord(const Table table, const resip::Data &key, bool isSecondaryKey);

    virtual int AddPlateInfo(std::string &plateName, std::string &plateType, float confidence, std::string &fPath,
                             std::string &pPath, std::string &time);

    virtual void QueryPlateInfoListSum(const std::string &startTime, const std::string &endTime, int &Sum);

    virtual void QueryPlateInfoList(int startNum, int endNum, const std::string &startTime, const std::string &endTime,
                                    std::vector<AbstractDb::PlateInfoRecord> &plateInfoRecordList);
};

#endif//! WebSocketService_WSProtocol_AbstractDb_H
